package com.facebook.imagepipeline.image;

import android.graphics.Bitmap;
import com.facebook.common.internal.Preconditions;
import com.facebook.common.references.CloseableReference;
import com.facebook.common.references.ResourceReleaser;
import com.facebook.imageutils.BitmapUtil;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;

@ThreadSafe
public class CloseableAnimatedBitmap extends CloseableBitmap
{

  @GuardedBy("this")
  private List<CloseableReference<Bitmap>> mBitmapReferences;
  private volatile List<Bitmap> mBitmaps;
  private volatile List<Integer> mDurations;

  public CloseableAnimatedBitmap(List<CloseableReference<Bitmap>> paramList, List<Integer> paramList1)
  {
    Preconditions.checkNotNull(paramList);
    if (paramList.size() >= i);
    int m;
    for (int k = i; ; m = 0)
    {
      Preconditions.checkState(k, "Need at least 1 frame!");
      this.mBitmapReferences = new ArrayList();
      this.mBitmaps = new ArrayList();
      Iterator localIterator = paramList.iterator();
      while (localIterator.hasNext())
      {
        CloseableReference localCloseableReference = (CloseableReference)localIterator.next();
        this.mBitmapReferences.add(localCloseableReference.clone());
        this.mBitmaps.add(localCloseableReference.get());
      }
    }
    this.mDurations = ((List)Preconditions.checkNotNull(paramList1));
    if (this.mDurations.size() == this.mBitmaps.size());
    while (true)
    {
      Preconditions.checkState(i, "Arrays length mismatch!");
      return;
      int j = 0;
    }
  }

  public CloseableAnimatedBitmap(List<Bitmap> paramList, List<Integer> paramList1, ResourceReleaser<Bitmap> paramResourceReleaser)
  {
    Preconditions.checkNotNull(paramList);
    if (paramList.size() >= i);
    int m;
    for (int k = i; ; m = 0)
    {
      Preconditions.checkState(k, "Need at least 1 frame!");
      this.mBitmaps = new ArrayList();
      this.mBitmapReferences = new ArrayList();
      Iterator localIterator = paramList.iterator();
      while (localIterator.hasNext())
      {
        Bitmap localBitmap = (Bitmap)localIterator.next();
        this.mBitmapReferences.add(CloseableReference.of(localBitmap, paramResourceReleaser));
        this.mBitmaps.add(localBitmap);
      }
    }
    this.mDurations = ((List)Preconditions.checkNotNull(paramList1));
    if (this.mDurations.size() == this.mBitmaps.size());
    while (true)
    {
      Preconditions.checkState(i, "Arrays length mismatch!");
      return;
      int j = 0;
    }
  }

  public void close()
  {
    try
    {
      if (this.mBitmapReferences == null)
        return;
      List localList = this.mBitmapReferences;
      this.mBitmapReferences = null;
      this.mBitmaps = null;
      this.mDurations = null;
      CloseableReference.closeSafely(localList);
      return;
    }
    finally
    {
    }
  }

  public List<Bitmap> getBitmaps()
  {
    return this.mBitmaps;
  }

  public List<Integer> getDurations()
  {
    return this.mDurations;
  }

  public int getHeight()
  {
    List localList = this.mBitmaps;
    if (localList == null)
      return 0;
    return ((Bitmap)localList.get(0)).getHeight();
  }

  public int getSizeInBytes()
  {
    List localList = this.mBitmaps;
    if ((localList == null) || (localList.size() == 0))
      return 0;
    return BitmapUtil.getSizeInBytes((Bitmap)localList.get(0)) * localList.size();
  }

  public Bitmap getUnderlyingBitmap()
  {
    List localList = this.mBitmaps;
    if (localList != null)
      return (Bitmap)localList.get(0);
    return null;
  }

  public int getWidth()
  {
    List localList = this.mBitmaps;
    if (localList == null)
      return 0;
    return ((Bitmap)localList.get(0)).getWidth();
  }

  public boolean isClosed()
  {
    try
    {
      List localList = this.mBitmaps;
      if (localList == null)
      {
        bool = true;
        return bool;
      }
      boolean bool = false;
    }
    finally
    {
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.facebook.imagepipeline.image.CloseableAnimatedBitmap
 * JD-Core Version:    0.6.2
 */